/**
 * Alibaba.com.cn Inc.
 * Copyright (c) 2004-2021 All Rights Reserved.
 */
package com.hiv.controller.admin;

import com.hiv.common.BaseController;
import com.hiv.common.WebResponse;
import com.hiv.common.param.StatisticsParam;
import com.hiv.common.response.DataPreviewStatistics;
import com.hiv.common.response.DiseaseStatistics;
import com.hiv.common.response.DrugResistanceStatistics;
import com.hiv.common.response.InspectionTrendStatistics;
import com.hiv.common.response.RealTimeSituationStatistics;
import com.hiv.common.response.SamplerStatisticsInfo;
import com.hiv.mapper.domain.Admin;
import com.hiv.service.StatisticsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
 * @author zhanghong
 * @version AdminIndexController.java, v 0.1 2022/9/24 10:38 下午 AdminIndexController Exp $$
 */
@RestController
@RequestMapping("/admin/index")
@Api(value = "统计概览模块", tags = {"【管理端】统计概览模块"})
public class AdminIndexController extends BaseController {
    @Autowired
    private StatisticsService statisticsService;

    @ApiOperation(value = "数据概览", httpMethod = "POST")
    @ApiResponses(value = {@ApiResponse(code = 200, message = "success")})
    @PostMapping("/dataPreview")
    public WebResponse<DataPreviewStatistics> dataPreviewStatistics(HttpServletRequest request, @RequestBody StatisticsParam param) {
        Admin admin = validAdminLoginAndGet(request);
        return WebResponse.build(statisticsService.dataPreviewStatistics(admin, param));
    }
    @ApiOperation(value = "实时概况", httpMethod = "POST")
    @ApiResponses(value = {@ApiResponse(code = 200, message = "success")})
    @PostMapping("/realTimeSituation")
    public WebResponse<RealTimeSituationStatistics> realTimeSituationStatistics(HttpServletRequest request, @RequestBody StatisticsParam param) {
        Admin admin = validAdminLoginAndGet(request);
        return WebResponse.build(statisticsService.realTimeSituationStatistics(admin, param));
    }
    @ApiOperation(value = "检测趋势图", httpMethod = "POST")
    @ApiResponses(value = {@ApiResponse(code = 200, message = "success")})
    @PostMapping("/inspectionTrend")
    public WebResponse<List<InspectionTrendStatistics>> inspectionTrendStatistics(HttpServletRequest request, @RequestBody StatisticsParam param) {
        Admin admin = validAdminLoginAndGet(request);
        return WebResponse.build(statisticsService.inspectionTrendStatistics(admin, param));
    }
    @ApiOperation(value = "病载含量", httpMethod = "POST")
    @ApiResponses(value = {@ApiResponse(code = 200, message = "success")})
    @PostMapping("/disease")
    public WebResponse<List<DiseaseStatistics>> diseaseStatistics(HttpServletRequest request, @RequestBody StatisticsParam param) {
        Admin admin = validAdminLoginAndGet(request);
        return WebResponse.build(statisticsService.diseaseStatistics(admin, param));
    }
    @ApiOperation(value = "耐药含量", httpMethod = "POST")
    @ApiResponses(value = {@ApiResponse(code = 200, message = "success")})
    @PostMapping("/drug")
    public WebResponse<List<DrugResistanceStatistics>> drugResistanceStatistics(HttpServletRequest request, @RequestBody StatisticsParam param) {
        Admin admin = validAdminLoginAndGet(request);
        return WebResponse.build(statisticsService.drugResistanceStatistics(admin, param));
    }
}
